
#ifndef CHARACTERS_CHARACTER_HH
#define CHARACTERS_CHARACTER_HH

#include <string>
#include <vector>
#include <iostream>
#include "items\item.hh"
#include "characters\ICharacter.hh"

/**
 * @class Character
 * @brief Base class for all character entities, including players and enemies.
 *
 * Implements shared character functionality such as health and status handling.
 */

class Character : public ICharacter
{
protected: // Accessible by derived classes (Player, Enemy)
    std::string name;
    std::string description;
    unsigned int health;
    unsigned int maxHealth;
    unsigned int attackPower;
    unsigned int defensePower;
    unsigned int maxDefensePower;

public:
    /**
     * @brief Constructor for the Character base class.
     * @param name Character's name.
     * @param description Character's description.
     * @param health Initial and current health points.
     * @param maxHealth Maximum health points.
     * @param attack Base attack power.
     * @param defense Base defense power.
     * * @param maxDefense Maximum defense points.
     */
    Character(std::string name, std::string description, unsigned int health, unsigned int maxHealth, unsigned int attack, unsigned int defense);

    // Virtual destructor (overrides ICharacter's default)
    virtual ~Character() override = default;

    // --- Concrete Implementations of ICharacter methods ---

    virtual bool isAlive() const override;
    virtual bool takeDamage(unsigned int damage) override; // Basic defense logic implemented
    virtual const std::string &getName() const override;
    virtual const std::string &getDescription() const override;
    virtual unsigned int getHealth() const override;
    virtual unsigned int getMaxHealth() const override;
    virtual unsigned int getAttackPower() const override;
    virtual unsigned int getDefensePower() const override;
    virtual unsigned int getMaxdefensePower() const override;
    virtual std::string toString() const override; // Basic string representation
    virtual void display() const override;         // Basic console display

    // Default (dummy) inventory implementations - override in Player
    virtual void addToInventory(Item *item) override;
    virtual void displayInventory() const override;

    // --- Core Action - Still Abstract ---
    // Attack logic is specific to derived classes (Player, specific Enemy types)
    // Therefore, it remains pure virtual here.
    virtual bool attack(ICharacter &target) override = 0;

    // --- Helper Setters/Modifiers ---
    // Provide basic setters; can be overridden if logic needs to be more complex.
    virtual void setHealth(unsigned int newHealth);
    virtual void setMaxHealth(unsigned int newMaxHealth);
    virtual void setAttackPower(unsigned int newAttack);
    virtual void setDefensePower(unsigned int newDefense);

};

#endif 
